package com.ruoyi.walmart.mapper.shipments;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.walmart.domain.shipments.ShipmentMatch;
import com.ruoyi.walmart.domain.shipments.ShipmentStock;
import com.ruoyi.walmart.domain.shipments.dto.CostFreightPair;
import com.ruoyi.walmart.domain.shipments.dto.MatchAggBySku;
import com.ruoyi.walmart.domain.shipments.dto.WalmartProfitReportDetailUpdate;
import com.ruoyi.walmart.domain.shipments.vo.ShipmentMatchVo;
import com.ruoyi.walmart.dto.FirstLegSummaryDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ShipmentMatchMapper extends BaseMapper<ShipmentMatch> {
    /**
     * 根据 shipment_id 和 sku 聚合已匹配的数量
     * @param skus
     * @return
     */
    List<MatchAggBySku> selectMatchedSumBySkus(@Param("skus")List<String> skus, @Param("authId")Long authId);
    /**
     * walmart匹配列表（成本、头程）
     */
    List<ShipmentMatchVo> selectShipmentMatchVotList(ShipmentMatchVo shipmentMatch);
    /**
     * 汇总账单匹配的数量，是否存在库存差异
     */
    List<ShipmentMatchVo> selectBatchShipmentMatchByIds(@Param("ids")List<Long> reportIds);
    /**
     * 查询每个 SKU 的加权平均成本和头程费用
     */
    List<CostFreightPair> selectAvgCostFreightBySku(@Param("authId")Long authId, @Param("wprId")Long wprId);

    void updateMatchFirstLegBatchById(@Param("list") List<ShipmentMatch> updateMatchList);

    List<FirstLegSummaryDTO> selectFirstLegSummaryByStockIdAndSku(@Param("stockId")String stockId);
}
